package org.eclipse.moquette.spi;

import org.eclipse.moquette.spi.impl.subscriptions.Subscription;

import java.util.List;
import java.util.Set;

/**
 * Created by alex on 15-5-31.
 */
public interface ISessionsStore {

    /**
     * 为session添加一个新的订阅
     * @param newSubscription
     * @param clientID
     */
    void addNewSubscription(Subscription newSubscription, String clientID);

    /**
     * 删除session的所有订阅
     * @param sessionID
     */
    void wipeSubscriptions(String sessionID);

    /**
     * 更新一些订阅到ClientID
     * @param clientID
     * @param subscriptions
     */
    void updateSubscriptions(String clientID, Set<Subscription> subscriptions);

    List<Subscription> listAllSubscriptions();

    /**
     * @return true if there are subscriptions persisted with clientID
     */
    boolean contains(String clientID);
}
